Skip to content

Conversation

@ThomasK33
Copy link
Member

@ThomasK33 ThomasK33 commented Nov 27, 2025

Summary

  • Fix workspace creation failing with "Unexpected response from server" due to Zod schema union ordering
  • z.union() was matching ResultSchema(z.void()) first, which stripped workspaceId/metadata as "extra keys"
  • Replaced with single ResultSchema using optional fields for consistent response shape

Test plan

  • make typecheck passes
  • useCreationWorkspace.test.tsx tests pass
  • Manual test: create new workspace from scratch - should navigate to workspace instead of showing error toast

Generated with mux

…ping

Zod's z.union() tries schemas in order and returns the first match.
The sendMessage output had ResultSchema(z.void()) first, which matched
{success: true} and stripped workspaceId/metadata as "extra keys" before
the workspace creation schema could match.

Fixed by using a single ResultSchema with optional workspaceId/metadata
fields instead of a union, ensuring consistent response shape.

Change-Id: Id55f726d7814d75f03169dfd5fa35bd0e4c38886
Signed-off-by: Thomas Kosiewski <tk@coder.com>
@ThomasK33 ThomasK33 enabled auto-merge November 27, 2025 18:01
@ThomasK33 ThomasK33 added this pull request to the merge queue Nov 27, 2025
Merged via the queue into main with commit df30cbc Nov 27, 2025
13 checks passed
@ThomasK33 ThomasK33 deleted the fix-sendmessage-schema-union-stripping branch November 27, 2025 18:21
ethanndickson added a commit that referenced this pull request Nov 28, 2025
Reverts:
- 470e4eb perf: fix streaming content delay from ORPC schema validation (#774)
- b437977 feat: add backend support for soft-interrupts (#767)
- df30cbc fix: use ResultSchema for sendMessage output to prevent field stripping (#773)
- 41c77ef fix: testUtils formatting (#771)
- 3ee7288 refactor: migrate IPC layer to ORPC for type-safe RPC (#763)
github-merge-queue bot pushed a commit that referenced this pull request Nov 28, 2025
Reverts:
- 470e4eb perf: fix streaming content delay from ORPC schema validation
(#774)
- b437977 feat: add backend support for soft-interrupts (#767)
- df30cbc fix: use ResultSchema for sendMessage output to prevent field
stripping (#773)
- 41c77ef fix: testUtils formatting (#771)
- 3ee7288 refactor: migrate IPC layer to ORPC for type-safe RPC (#763)

Due to a huge number of regressions.

_Generated with `mux`_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant